package com.xing.async;

public class TestMain {

    public static void main(String[] args) {
        AsyncManagerImpl asyncManager = new AsyncManagerImpl(
                128,
                Runtime.getRuntime().availableProcessors(),

        new QueueMessageProcessor(new IMessageHandler<IMessageBase>() {
            @Override
            public void execute(IMessageBase message) {

            }

            @Override
            public short[] getTypes() {
                return new short[0];
            }
        }));

        asyncManager.createOperationAndExecuteAtOnce(new IIoOperation() {

            @Override
            public int doStart() {
                return STAGE_START_DONE;
            }

            @Override
            public int doStop() {
                return STAGE_STOP_DONE;
            }

            @Override
            public int doIo() {
//                if (ll == null) {
//                    // 被打玩家经常不在本线，就更新新的数据
//                    Player player = loadPlayer(lo.getId());
//                    if (player != null) {
//                        // 做一下能力比对，防止刷。先比较参战宠物，个数。比较每个能力。比较玩家能力
//                        if (getCharPropertyValue(lo) - getCharPropertyValue(player.getCharacter()) < 0) {
//                            players.put(lo.getId(), player);
//                        }
//                    }
//                }
//
//                final PlayerCharacter pc = player.getCharacter();
//                if (pc != null) {
//                    Player player = loadPlayer(pc.getId());
//                    if (player != null) {
//                        players.put(pc.getId(), player);
//                    }
//                }
                return STAGE_IO_DONE;
            }
        });
    }
}
